<template>
  <view class="page">
    <view class="content"><jyf-parser :html="body"></jyf-parser></view>
    <view class="oper-box"  v-if="body">
      <view class="agreement">
        <image class="image" @click="handle_select" v-if="is_select_agree" :src="imgBaseUrl + 'checked.png'"></image>
        <image class="image" @click="handle_select" v-else  :src="imgBaseUrl + 'unchecked.png'"></image>
        <view><text>{{i18n['我已阅读并同意以上协议']}}</text></view>
      </view>
      <view  class="login-btn" @click="handleNext" v-if="body"> 
      	{{i18n['下一步，填写申请信息']}}
      </view>
    </view>
    <!-- 断网监测 start -->
    <fu-notwork></fu-notwork>
    <!-- 断网监测 end -->

  </view>
</template>

<script>
import richText from "@/common/utils/richText.js";
export default {
  data() {
    return {
      body: '',
      is_select_agree:false
    };
  },
  onLoad() {
    this.getShopAgreement();
  },
  methods: {
    /**
     * @param 是否选择同意协议
     */
    handle_select() {
    	this.is_select_agree = !this.is_select_agree
    },
    handleNext(){
      if(!this.is_select_agree) return this.$message.info(this.i18n['请阅读并同意以上协议']);
      uni.navigateTo({
        // url:'/pages/goods/shop/shop-package/index',
        url:'/pages/goods/shop/shop-info/index',
      })
    },
    getShopAgreement(){
      this.$api
        .post(global.apiUrls.getShopAgreement)
        .then(res => {
          console.log(res);
          if(res.data.code == 1){
             this.body = richText.format(res.data.data.content);
          }else{
            this.$message.info(res.data.msg);
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  }
};
</script>

<style scoped lang="scss">
page,.page {
  min-height: 100vh;
  background: #ffffff;
  padding: 0 32rpx;
}
// .page{
//   padding-bottom: calc(64rpx + constant(safe-area-inset-bottom));
//   padding-bottom: calc(64rpx + env(safe-area-inset-bottom));
// }
.content {
  min-height: 800rpx;
  padding-bottom: 240rpx;
}
.agreement {
  display: flex;
  font-family: PingFangSC-Regular;
  font-size: 28rpx;
  color: #666666;
  align-items: center;
  justify-content: center;
  margin-top: 32rpx;
  .image {
    height: 28rpx;
    width: 28rpx;
    margin-right: 12rpx;
  }

  text {
    color: #999999;
  }
}
.login-btn {
			height: 88rpx;
      line-height: 88rpx;
			background: #FD9CAE;
			opacity: 1;
			border-radius: 44rpx;
			margin: 30rpx 0rpx;
			font-size: 32rpx;
      color: #FFFFFF;
			font-family: PingFang SC;
      text-align: center;
}
.oper-box{
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #FFFFFF;
  display: flex;
  flex-direction: column;
  padding: 0 32rpx;
}
</style>
